<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include/src :: form_base_js_and_css"/>
</head>
<body style="background-color: #f2f2f2; height: 100%;">

<div id="id_panel">
</div>
<script th:inline="javascript">
	var dto = $.parseJSON(JSON.stringify([[${dto}]]));
	var isReSet = '[(${isReSet})]';
	//只有流转中才能
	if (dto.flowRefuseBtn.state == 1 && dto.saveBtn.state != 1){
		dto.saveBtn.state = 1;
		var rows = dto.rows;
		for (let i = 0; i < rows.length; i++) {
			if (rows[i].code === "vid"){
				rows[i].type = 't_text'
				rows[i].stateReadonly = 1
			}
			if (rows[i].code === "remark"){
				rows[i].type = 't_text'
				rows[i].stateReadonly = 1
			}
			if(isReSet == '1' && rows[i].code === "vid"){
				rows[i].type = 't_buttontext'
				rows[i].stateReadonly = 1
			}
		}
	}

	console.log("dto", dto);
	// 表单初始化
	var formObj = null;
	//使用layui的sku模块
	layui.config({
		//自定义layui组件的目录,设定扩展的layui模块的所在目录，一般用于外部模块扩展
		base: '/static/js/layui_extends/',
		version: true
	}).use(['form', 'jquery', 'laydate', 'YsForm', 'YsModal'], function(){
		var $ = layui.jquery,
				form = layui.form,
				laydate = layui.laydate,
				YsForm = layui.YsForm,
				YsModal = layui.YsModal;
		/*
		* 表单初始化
		* 参数1：表单配置参数
		* 参数2：子表配置参数
		*/
		formObj = YsForm.init(
				{
					id:'id_panel', // 页面容器ID
					dto: dto
				}
		);


		if(isReSet == '1'){
			//监听
			//重写弹出框
			formObj.showModal=function(modalKey, colCode) {
				var t = formObj;
				var vyhzhmc = formObj.getValueByName("vyhzhmc");//购买方公司名称
				if(colCode == 'vid' && vyhzhmc){//付款户名弹框 modalKey=TB_CompanyBankInfo_ByContract
					layui.YsModal.init({modalKey: modalKey, colCode: colCode, parentObj: t, extraData:{}, conditionsDefault: [{code: 'vyhzhmc', value:vyhzhmc}], sameCode: 'xx'});
				}else{
					// 打开单选框,
					layui.YsModal.init({modalKey: modalKey, colCode: colCode, parentObj: t, extraData:{}, conditionsDefault: [{code: 'aaa', value:'123'},{code: 'bbb', value:'456'}], sameCode: 'xx'});
				}

			}
		}





	});


</script>

</body>
</html>